import { createRouter, createWebHashHistory } from "vue-router";
import type { App } from "vue";
// 引入布局组件
import CaseLayout from '@/layouts/CaseLayout.vue'
export const routes = [
    {
        path: "/",
        redirect: "/home",
    },
    {
        path: "/home",
        component: () => import("@/pages/home/index.vue"),
        name: "Home",
        meta: {
            hidden: true,
            title: "首页",
            noTagsView: true,
        },
    },
    // 布局路由 - 所有案例页面作为它的子路由
    {
        path: "/cases",
        component: CaseLayout, // 应用布局组件
        meta: { hidden: true },
        children: [
            {
                path: "/leeui/table",
                component: () => import("@/pages/leeui/table.vue"),
                name: "leeui-table",
                meta: {
                    title: "LeeUI 列表",
                    noTagsView: true,
                },
            },
            {
                path: "/leeui/form",
                component: () => import("@/pages/leeui/form.vue"),
                name: "leeui-form",
                meta: {
                    title: "LeeUI 表单",
                    noTagsView: true,
                },
            },
            {
                path: "/leeui/com",
                component: () => import("@/pages/leeui/com.vue"),
                name: "leeui-com",
                meta: {
                    title: "LeeUI 单个组件",
                    noTagsView: true,
                },
            },
            {
                path: "/element/form", // 修正之前的路径冲突
                component: () => import("@/pages/element/form.vue"),
                name: "element-form",
                meta: {
                    title: "Element 表单",
                    noTagsView: true,
                },
            },
            {
                path: "/element/table", // 修正之前的路径冲突
                component: () => import("@/pages/element/table.vue"),
                name: "element-table",
                meta: {
                    title: "Element 表格",
                    noTagsView: true,
                },
            },
        ]
    }
    // {
    //     path: "/leeui/table",
    //     component: () => import("@/pages/leeui/table.vue"),
    //     name: "leeui-table",
    //     meta: {
    //         hidden: true,
    //         title: "列表",
    //         noTagsView: true,
    //     },
    // },
    // {
    //     path: "/leeui/form",
    //     component: () => import("@/pages/leeui/form.vue"),
    //     name: "leeui-form",
    //     meta: {
    //         hidden: true,
    //         title: "表单",
    //         noTagsView: true,
    //     },
    // },
    // {
    //     path: "/leeui/com",
    //     component: () => import("@/pages/leeui/com.vue"),
    //     name: "leeui-com",
    //     meta: {
    //         hidden: true,
    //         title: "单个组件",
    //         noTagsView: true,
    //     },
    // },
    // {
    //     path: "/element/com",
    //     component: () => import("@/pages/element/form.vue"),
    //     name: "element-form",
    //     meta: {
    //         hidden: true,
    //         title: "表单",
    //         noTagsView: true,
    //     },
    // },
    // {
    //     path: "/element/com",
    //     component: () => import("@/pages/element/table.vue"),
    //     name: "element-table",
    //     meta: {
    //         hidden: true,
    //         title: "表格",
    //         noTagsView: true,
    //     },
    // },
];
// 3. 创建路由实例并传递 `routes` 配置
// 你可以在这里输入更多的配置，但我们在这里
// 暂时保持简单
export const router = createRouter({
    // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
    history: createWebHashHistory(),
    routes, // `routes: routes` 的缩写
});
export const setupRouter = (app: App<Element>) => {
    app.use(router);
};
export default router;